
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 10/31/2013 08:57:13
-- Generated from EDMX file: E:\ZZLProject\losezhang\aop_cache\aop_cache_Entity\Model1.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [TsingDa_NewLearningBar];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Classroom_Info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Classroom_Info];
GO
IF OBJECT_ID(N'[dbo].[User_Classroom_R]', 'U') IS NOT NULL
    DROP TABLE [dbo].[User_Classroom_R];
GO
IF OBJECT_ID(N'[dbo].[User_Info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[User_Info];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Classroom_Info'
CREATE TABLE [dbo].[Classroom_Info] (
    [ClassroomInfoID] int IDENTITY(1,1) NOT NULL,
    [UserInfoID] int  NOT NULL,
    [Title] nvarchar(200)  NOT NULL,
    [Description] nvarchar(500)  NOT NULL,
    [AddTime] datetime  NOT NULL,
    [Province] nvarchar(20)  NOT NULL,
    [City] nvarchar(20)  NOT NULL,
    [District] nvarchar(20)  NOT NULL,
    [Type] int  NOT NULL,
    [Status] int  NOT NULL,
    [ImagePath] nvarchar(200)  NOT NULL,
    [Feather] int  NOT NULL,
    [PreheatDay] int  NOT NULL,
    [SellTime] datetime  NOT NULL,
    [PlacesCount] int  NOT NULL
);
GO

-- Creating table 'User_Classroom_R'
CREATE TABLE [dbo].[User_Classroom_R] (
    [UserClassroomRID] int IDENTITY(1,1) NOT NULL,
    [UserInfoID] int  NOT NULL,
    [ClassroomInfoID] int  NOT NULL,
    [AddTime] datetime  NOT NULL,
    [EndTime] datetime  NOT NULL
);
GO

-- Creating table 'User_Info'
CREATE TABLE [dbo].[User_Info] (
    [UserInfoID] int IDENTITY(1,1) NOT NULL,
    [UserName] nvarchar(50)  NOT NULL,
    [Password] nvarchar(50)  NOT NULL,
    [NickName] nvarchar(50)  NOT NULL,
    [Email] nvarchar(200)  NOT NULL,
    [RealName] nvarchar(50)  NOT NULL,
    [IDCard] nvarchar(50)  NOT NULL,
    [Photo] nvarchar(200)  NOT NULL,
    [Sex] bit  NOT NULL,
    [Phone] nvarchar(50)  NOT NULL,
    [Profile] nvarchar(400)  NOT NULL,
    [Description] nvarchar(400)  NOT NULL,
    [AddTime] datetime  NOT NULL,
    [Province] nvarchar(20)  NOT NULL,
    [City] nvarchar(20)  NOT NULL,
    [District] nvarchar(20)  NOT NULL,
    [Birthday] datetime  NOT NULL,
    [RoleType] int  NOT NULL,
    [Status] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [ClassroomInfoID] in table 'Classroom_Info'
ALTER TABLE [dbo].[Classroom_Info]
ADD CONSTRAINT [PK_Classroom_Info]
    PRIMARY KEY CLUSTERED ([ClassroomInfoID] ASC);
GO

-- Creating primary key on [UserClassroomRID] in table 'User_Classroom_R'
ALTER TABLE [dbo].[User_Classroom_R]
ADD CONSTRAINT [PK_User_Classroom_R]
    PRIMARY KEY CLUSTERED ([UserClassroomRID] ASC);
GO

-- Creating primary key on [UserInfoID] in table 'User_Info'
ALTER TABLE [dbo].[User_Info]
ADD CONSTRAINT [PK_User_Info]
    PRIMARY KEY CLUSTERED ([UserInfoID] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------